module.exports = function modelGenerator(name) {
  const formatName = name
    .trim()
    .toLowerCase()
    .replace(name[0], name[0].toUpperCase());
  return `import React, { useState, useEffect } from 'react';
import { ConnectRC, connect } from 'umi';
import { ConnectState } from '@/models/connect';
import { ${formatName}ModelState } from '@/models/modules/${name}';

import './index.less';

interface ${formatName}Props {
    ${name}: ${formatName}ModelState;
}

const ${formatName}Page: ConnectRC<${formatName}Props> = (props) => {
  const [loading, setLoading] = useState<boolean>(false);

  const { ${name} } = props;

  useEffect(() => {}, []);

  return <div>page index</div>;
};

export default connect(({ ${name} }: ConnectState) => ({
    ${name},
}))(${formatName}Page);
`;
};
